package com.itheima.day05;
/*
案例2:
判断从n--m之间的奇数和偶数:
 */

public class TestClassCase02 {

    public static void main(String[] args) {

        print(10,20);
    }

    public  static void print(int n, int m){

        if (n <= m) {

            System.out.println("奇数:");
            for (int i = n; i <= m; i++) {
                if (i%2!=0){
                    System.out.println(i);
                }
            }

            System.out.println("偶数:");
            for (int i = n; i <= m; i++) {
                if (i%2==0){
                    System.out.println(i);
                }
            }
        }else{

            System.out.println("奇数:");
            for (int i = m; i <= n; i++) {
                if (i%2!=0){
                    System.out.println(i);
                }
            }

            System.out.println("偶数:");
            for (int i = m; i <= n; i++) {
                if (i%2==0){
                    System.out.println(i);
                }
            }
        }






    }
}
